package com.forum.module.blog.convert.favorite;

import com.forum.framework.common.util.colletion.CollectionUtils;
import com.forum.framework.common.util.object.BeanUtils;
import com.forum.module.blog.controller.comment.vo.CommentRespVO;
import com.forum.module.blog.controller.favorite.vo.FavoriteRespVO;
import com.forum.module.blog.convert.comment.CommentConvert;
import com.forum.module.blog.dal.dataobject.comment.CommentDO;
import com.forum.module.blog.dal.dataobject.favorite.FavoriteDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/4 19:35
 */
@Mapper
public interface FavoriteConvert {
    FavoriteConvert INSTANCE = Mappers.getMapper(FavoriteConvert.class);

    default List<FavoriteRespVO> covertList(List<FavoriteDO> list) {
        return CollectionUtils.convertList(list, this::covert);
    }

    default FavoriteRespVO covert(FavoriteDO favoriteDO) {
        return BeanUtils.toBean(favoriteDO, FavoriteRespVO.class);
    }
}
